<template>
  <Layout>
    <h1>最新动态</h1>
    <!--    <p v-for="id in $page.Index.id">{{id}}</p>-->
    <!--    <p>{{ $page.allIndex.edges[0] }}</p>-->
    <el-card shadow="never" style="min-height: 400px">
      <div slot="header">
        <span>{{ $page.allIndex.edges[0].node.title }}</span>
      </div>
      <div style="font-size: 0.9rem;line-height: 1.5;color: #606c71;">
        发布 {{ $page.allIndex.edges[0].node.createTime | utcToLocal }}
        <br> 更新 {{ $page.allIndex.edges[0].node.updateTime | utcToLocal }}
      </div>
      <div
          style="font-size: 1.1rem;line-height: 1.5;color: #303133;border-bottom: 1px solid #E4E7ED;padding: 5px 0px 5px 0px">
        <pre style="font-family: '微软雅黑'">{{ $page.allIndex.edges[0].node.description }}</pre>
      </div>
      <div v-html="mdToHtml($page.allIndex.edges[0].node.content)" class="markdown-body"
           style="padding-top: 20px"></div>
    </el-card>
  </Layout>
</template>

<page-query>
query {
  allIndex{
    edges{
      node{
        id
        title
        content
        description
        createTime
        updateTime
      }
    }
  }
}
</page-query>

<script>
import MarkdownIt from 'markdown-it'
const md = new MarkdownIt()

export default {
  metaInfo: {
    title: '最新动态'
  },
  data() {
    return {}
  },
  methods: {
    mdToHtml(content) {
      return md.render(content)
    },
  },
  mounted() {
    console.log(this)
  }
}
</script>

<style>
</style>
